<?php
include_once("config.php");


if ($_GET['content'] == 1)
{
print "<b>Overzicht gebruikers</b><br />
        &nbsp;<br />";

//Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

//Get results from database members
$result = mysql_query("SELECT * FROM members")
or die(mysql_error());

//View results from database members
echo "<table border='1' align=center bgcolor='#CCCCCC'>";
echo "<tr>
                <td>ID</td>
                <td>naam</td>
                <td>bandbreedte</td>
                <td>gebruikers</td>
                <td>authenticatie</td>
                <td>gebruikers</td>
                <td>domein</td>
                <td>groepen</td>
                <td>administratie</td>
                <td><a href='?'>Verwijderen/wijzigen</a></td>
      </tr>";

//Keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
//Print out the contents of each row into a table
	echo "<tr><td>";
	echo $row['id'];
	echo "</td><td>";
	echo $row['username'];
	echo "</td><td>";
	echo $row['bandbreedte'];
	echo "&nbsp;</td><td>";
	echo $row['gebruikers'];
        echo "</td><td>";
	echo $row['authenticatie'];
        echo "</td><td>";
	echo $row['domein'];
        echo "</td><td>";
	echo $row['groepen'];
        echo "</td><td>";
	echo $row['administratie'];
    echo "</td><td>";
    echo "<td><a href='id?=" . $row['id'] . "'>Verwijderen/wijzigen</a></td>";
}
echo "</table>";

}
if ($_GET['content'] == 2)
{

print '<table width="330" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr><table width="330" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<form name="form1" method="post" action="create_user.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3" align="center"><strong>Create new user</strong></td>
</tr>
<tr>
<td width="78">Username</td>
<td width="6">:</td>
<td width="294"><input name="myusername" type="text" id="myusername"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="mypassword" type="password" id="mypassword"></td>
</tr>
<tr>
<td>Repeat password</td>
<td>:</td>
<td><input name="repeatpassword" type="password" id="repeatpassword"></td>
</tr>
<tr>
<td>Bandbreedte</td>
<td>:</td>
<td><input type="checkbox" name="bandbreedte" value="1" /></td>
</tr>
<tr>
<td>Gebruikers</td>
<td>:</td>
<td><input type="checkbox" name="gebruikers" value="1" /></td>
</tr>
<tr>
<td>Authenticatie</td>
<td>:</td>
<td><input type="checkbox" name="authenticatie" value="1" /></td>
</tr>
<tr>
<td>Domein</td>
<td>:</td>
<td><input type="checkbox" name="domein" value="1" /></td>
</tr>
<tr>
<td>Groepen</td>
<td>:</td>
<td><input type="checkbox" name="groepen" value="1" /></td>
</tr>
<tr>
<td>Administratie</td>
<td>:</td>
<td><input type="checkbox" name="administratie" value="1" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Create new user"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>';

}
if ($_GET['content'] == 3)
{
    print "<b>Overzicht groepen</b><br />
        &nbsp;<br />";

    mysql_connect("$host", "$username", "$password")or die("cannot connect");
    mysql_select_db("$db_name")or die("cannot select DB");

    //Get results from database members
    $result = mysql_query("SELECT * FROM groups")
    or die(mysql_error());

    //View results from database members
    echo "<table style=\"border-collapse: collapse;border: 1px solid #000000;\">";
    echo "<tr>
                    <td style=\"border: 1px solid #000000;padding: 3px;\" bgcolor=\"#CCCCCC\">ID</td>
                    <td style=\"border: 1px solid #000000;padding: 3px;\" bgcolor=\"#CCCCCC\">Groepsnaam</td>
                    <td style=\"border: 1px solid #000000;padding: 3px;\" bgcolor=\"#CCCCCC\">#</td>
          </tr>";

    //Keeps getting the next row until there are no more to get
    while($row = mysql_fetch_array( $result )) {
        echo "<tr>";
        echo "<td style=\"border: 1px solid #000000;padding: 3px;\">" . $row['groupid'] . "</td>";
        echo "<td style=\"border: 1px solid #000000;padding: 3px;\">" . $row['groupname'] . "</td>";
        echo "<td style=\"border: 1px solid #000000;padding: 3px;\">0</td>";
        echo "</tr>";
    }

    echo "</table>";
}
if ($_GET['content'] == 4)
{
    print '<b>Nieuwe groep</b><br />
            &nbsp;<br />
            <form name="groep">
            <table>
            <tr>
            <td>Groepsnaam:</td>
            <td><input type="text" name="txtGroepsnaam" />
            </tr>
            <tr>
            <td colspan="2">
            <input type="button" value="Opslaan" onclick="savegroup(document.groep.txtGroepsnaam.value)"/>
            </td>
            </tr>
            </table>
    ';

}
if ($_GET['content'] == 5)
{

}

?>
